Replace causes() with iter_chain()
authorVasudev Kamath <vasudev@copyninja.info>
Mon, 13 Aug 2018 15:07:13 +0000 (20:37 +0530)
committerVasudev Kamath <vasudev@copyninja.info>
Mon, 13 Aug 2018 15:07:13 +0000 (20:37 +0530)
causes() in failure crate is deprecated and since cargo
does not allow warnings causes build failure.
Forwarded: no
Last-Update: 2018-08-11

Gbp-Pq: Name 1001_failure_deprecated_fix.patch

src/cargo/core/compiler/fingerprint.rs
src/cargo/lib.rs
src/cargo/util/config.rs
src/cargo/util/errors.rs
src/cargo/util/network.rs
tests/testsuite/cargotest/support/mod.rs
tests/testsuite/config.rs

index e3783ddb6ceb4b963e08300663d06406a72705d8..aae2696420282d81dd2c6dcb78314359d322dd1e 100644 (file)
@@ -679,7 +679,7 @@ fn log_compare(unit: &Unit, compare: &CargoResult<()>) {
     };
     info!("fingerprint error for {}: {}", unit.pkg, ce);
 
-    for cause in ce.causes().skip(1) {
+    for cause in ce.iter_chain().skip(1) {
         info!("  cause: {}", cause);
     }
 }
index e51dfe87a05737eeb9e29fcdfa8ee58bf4e92403..ed7cc9da4c3b12b5c47cfd2aef0f46c762a8cd72 100644 (file)
@@ -169,13 +169,13 @@ fn handle_cause(cargo_err: &Error, shell: &mut Shell) -> bool {
     if verbose == Verbose {
         // The first error has already been printed to the shell
         // Print all remaining errors
-        for err in cargo_err.causes().skip(1) {
+        for err in cargo_err.iter_chain().skip(1) {
             print(err.to_string(), shell);
         }
     } else {
         // The first error has already been printed to the shell
         // Print remaining errors until one marked as Internal appears
-        for err in cargo_err.causes().skip(1) {
+        for err in cargo_err.iter_chain().skip(1) {
             if err.downcast_ref::<Internal>().is_some() {
                 return false;
             }
index 2b4bdf565a6137951ec08281208c3e67f1253453..388476bcdba023ac1d274a465c76e7c8d6be54fe 100644 (file)
@@ -921,7 +921,7 @@ impl fmt::Display for ConfigError {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         let message = self
             .error
-            .causes()
+            .iter_chain()
             .map(|e| e.to_string())
             .collect::<Vec<_>>()
             .join("\nCaused by:\n  ");
index bbbaa785432c1e2008163f990d6ff0c2a44cc2c3..e8c0449187dec7b2c809b5752ba12acc134015b7 100644 (file)
@@ -56,7 +56,7 @@ impl Internal {
 
 impl Fail for Internal {
     fn cause(&self) -> Option<&Fail> {
-        self.inner.cause().cause()
+        self.inner.as_fail().cause()
     }
 }
 
index 55b18a4cd0d65ffd572b4b406b0f2b301c1b1a8f..cc389cc2b03f9d0762281b3e53b219d5aaba79e8 100644 (file)
@@ -7,7 +7,7 @@ use util::Config;
 use util::errors::{CargoResult, HttpNot200};
 
 fn maybe_spurious(err: &Error) -> bool {
-    for e in err.causes() {
+    for e in err.iter_chain() {
         if let Some(git_err) = e.downcast_ref::<git2::Error>() {
             match git_err.class() {
                 git2::ErrorClass::Net | git2::ErrorClass::Os => return true,
index 677f90a316f39a508d0958a7cf9f8ef7f25aa3c6..112ea059fecbc6dffcc304f694a04c8916c963bc 100644 (file)
@@ -1067,7 +1067,7 @@ impl<'a> ham::Matcher<&'a mut ProcessBuilder> for Execs {
                     return self.match_output(out);
                 }
                 let mut s = format!("could not exec process {}: {}", process, e);
-                for cause in e.causes() {
+                for cause in e.iter_chain() {
                     s.push_str(&format!("\ncaused by: {}", cause));
                 }
                 Err(s)
index f9d33e8c4cbb8d5975406f4c2f4b9c041dabd06f..68375c615f917012195b6fcef38f0d578a8a7723 100644 (file)
@@ -69,7 +69,7 @@ fn new_config(env: &[(&str, &str)]) -> Config {
 
 fn assert_error(error: CargoError, msgs: &str) {
     let causes = error
-        .causes()
+        .iter_chain()
         .map(|e| e.to_string())
         .collect::<Vec<_>>()
         .join("\n");